home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 28
/
Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso
/
Aminet
/
dev
/
lang
/
fpc09905c.lha
/
fpc
/
units
/
crt.pp
< prev
next >
Wrap
Text File
|
1998-09-21
|
26KB
|
1,022 lines
{
$Id: crt.pp,v 1.5 1998/09/14 20:21:53 carl Exp $
This file is part of the Free Pascal run time library.
Copyright (c) 1998 by Nils Sjoholm and Carl Eric Codere
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
unit Crt;
{--------------------------------------------------------------------}
{ LEFT TO DO: }
{--------------------------------------------------------------------}
{ o Write special characters are not recognized }
{ o Write does not take care of window coordinates yet. }
{ o Read does not recognize the special editing characters }
{ o Read does not take care of window coordinates yet. }
{ o Readkey extended scancode is not correct yet }
{ o Color mapping only works for 4 colours }
{ o ClrScr, DeleteLine, InsLine do not work with window coordinates }
{--------------------------------------------------------------------}
Interface
Const
{ Controlling consts }
Flushing=false; {if true then don't buffer output}
ScreenWidth = 80;
ScreenHeight = 25;
{ CRT modes }
BW40 = 0; { 40x25 B/W on Color Adapter }
CO40 = 1; { 40x25 Color on Color Adapter }
BW80 = 2; { 80x25 B/W on Color Adapter }
CO80 = 3; { 80x25 Color on Color Adapter }
Mono = 7; { 80x25 on Monochrome Adapter }
Font8x8 = 256; { Add-in for ROM font }
{ Mode constants for 3.0 compatibility }
C40 = CO40;
C80 = CO80;
{
When using this color constants on the Amiga
you can bet that they don't work as expected.
You never know what color the user has on
his Amiga. Perhaps we should do a check of
the number of bitplanes (for number of colors)
The normal 4 first pens for an Amiga are
0 LightGrey
1 Black
2 White
3 Blue
}
{ Foreground and background color constants }
Black = 1; { normal pen for amiga }
Blue = 3; { windowborder color }
Green = 15;
Cyan = 7;
Red = 4;
Magenta = 5;
Brown = 6;
LightGray = 0; { canvas color }
{ Foreground color constants }
DarkGray = 8;
LightBlue = 9;
LightGreen = 10;
LightCyan = 11;
LightRed = 12;
LightMagenta = 13;
Yellow = 14;
White = 2; { third color on amiga }
{ Add-in for blinking }
Blink = 128;
{Other Defaults}
LastMode : Word = 3;
WindMin : Word = $0;
WindMax : Word = $184f;
{ These don't change anything if they are modified }
CheckSnow : Boolean = FALSE;
DirectVideo: Boolean = FALSE;
var
TextAttr : BYTE;
{ CheckBreak have to make this one to a function for Amiga }
CheckEOF : Boolean;
Procedure AssignCrt(Var F: Text);
Function KeyPressed: Boolean;
Function ReadKey: Char;
Procedure TextMode(Mode: Integer);
Procedure Window(X1, Y1, X2, Y2: BYTE);
Procedure GoToXy(X: byte; Y: byte);
Function WhereX: Byte;
Function WhereY: Byte;
Procedure ClrScr;
Procedure ClrEol;
Procedure InsLine;
Procedure DelLine;
Procedure TextColor(Color: Byte);
Procedure TextBackground(Color: Byte);
Procedure LowVideo;
Procedure HighVideo;
Procedure NormVideo;
Procedure Delay(DTime: Word);
Procedure Sound(Hz: Word);
Procedure NoSound;
{ Extra functions }
Procedure CursorOn;
Procedure CursorOff;
Function CheckBreak: Boolean;
Implementation
{
The definitions of TextRec and FileRec are in separate files.
}
{$i textrec.inc}
{$i filerec.inc}
var
maxcols,maxrows : longint;
CONST
{ This is used to make sure that readkey returns immediately }
{ if keypressed was used beforehand. }
KeyPress : char = #0;
_LVODisplayBeep = -96;
Type
pInfoData = ^tInfoData;
tInfoData = packed record
id_NumSoftErrors : Longint; { number of soft errors on disk }
id_UnitNumber : Longint; { Which unit disk is (was) mounted on }
id_DiskState : Longint; { See defines below }
id_NumBlocks : Longint; { Number of blocks on disk }
id_NumBlocksUsed : Longint; { Number of block in use }
id_BytesPerBlock : Longint;
id_DiskType : Longint; { Disk Type code }
id_VolumeNode : Longint; { BCPL pointer to volume node }
id_InUse : Longint; { Flag, zero if not in use }
end;
{ * List Node Structure. Each member in a list starts with a Node * }
pNode = ^tNode;
tNode = packed Record
ln_Succ, { * Pointer to next (successor) * }
ln_Pred : pNode; { * Pointer to previous (predecessor) * }
ln_Type : Byte;
ln_Pri : Shortint; { * Priority, for sorting * }
ln_Name : PChar; { * ID string, null terminated * }
End; { * Note: Integer aligned * }
{ normal, full featured list }
pList = ^tList;
tList = packed record
lh_Head : pNode;
lh_Tail : pNode;
lh_TailPred : pNode;
lh_Type : Byte;
l_pad : Byte;
end;
pMsgPort = ^tMsgPort;
tMsgPort = packed record
mp_Node : tNode;
mp_Flags : Byte;
mp_SigBit : Byte; { signal bit number }
mp_SigTask : Pointer; { task to be signalled (TaskPtr) }
mp_MsgList : tList; { message linked list }
end;
pMessage = ^tMessage;
tMessage = packed record
mn_Node : tNode;
mn_ReplyPort : pMsgPort; { message reply port }
mn_Length : Word; { message len in bytes }
end;
pIOStdReq = ^tIOStdReq;
tIOStdReq = packed record
io_Message : tMessage;
io_Device : Pointer; { device node pointer }
io_Unit : Pointer; { unit (driver private)}
io_Command : Word; { device command }
io_Flags : Byte;
io_Error : Shortint; { error or warning num }
io_Actual : Longint; { actual number of bytes transferred }
io_Length : Longint; { requested number bytes transferred}
io_Data : Pointer; { points to data area }
io_Offset : Longint; { offset for block structured devices }
end;
pIntuiMessage = ^tIntuiMessage;
tIntuiMessage = packed record
ExecMessage : tMessage;
IClass : Longint;
Code : Word;
Qualifier : Word;
IAddress : Pointer;
MouseX,
MouseY : Word;
Seconds,
Micros : Longint;
IDCMPWindow : Pointer;
SpecialLink : pIntuiMessage;
end;
pWindow = ^tWindow;
tWindow = packed record
NextWindow : pWindow; { for the linked list in a screen }
LeftEdge,
TopEdge : Integer; { screen dimensions of window }
Width,
Height : Integer; { screen dimensions of window }
MouseY,
MouseX : Integer; { relative to upper-left of window }
MinWidth,
MinHeight : Integer; { minimum sizes }
MaxWidth,
MaxHeight : Word; { maximum sizes }
Flags : Longint; { see below for defines }
MenuStrip : Pointer; { the strip of Menu headers }
Title : PChar; { the title text for this window }
FirstRequest : Pointer; { all active Requesters }
DMRequest : Pointer; { double-click Requester }
ReqCount : Integer; { count of reqs blocking Window }
WScreen : Pointer; { this Window's Screen }
RPort : Pointer; { this Window's very own RastPort }
Bor